using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using Framework.Library.Utilities;
using Framework.Module.CMS.Library;
using Framework.Library;
using Framework.Module.CMS.Library.Distributions;
using Framework.Module.CMS.Library.Comments;
using Framework.Module.CMS.Library.Definitions;

namespace Framework.Module.CMS.Web.HomePage
{
    public partial class RightTopFeedback : CMSWebControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            DataTable tbl = CommentDB.TopComments(5, ConvertUtility.ToInt32(this.Portal[Constants.CMS_PortalTT]));
            if (tbl != null && tbl.Rows.Count > 0)
            {
                this.rpt.DataSource = tbl;
                this.rpt.DataBind();
            }
            else
            {
                this.Visible = false;
            }
        }
        protected void rptNewsMostViews_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataRowView currow = (DataRowView)e.Item.DataItem;
                HyperLink hplTitle = (HyperLink)e.Item.FindControl("hplTitle");
                hplTitle.Text = ConvertUtility.ToString(currow["Content_Headline"]);
                hplTitle.NavigateUrl = BuildUrlByDistId(DistributionController.GetDistID((int)currow["Distribution_ContentID"]), (int)currow["Distribution_ZoneID"]);
            }
        }
    }
}